package generator.domain;

import java.time.LocalDateTime;
import lombok.Data;

/**
 * 
 * @TableName user_follows
 */
@Data
public class UserFollows {
    /**
     * 
     */
    private Integer id;

    /**
     * 关注者ID（关联用户表，业务层校验）
     */
    private Integer followerId;

    /**
     * 被关注者ID（关联用户表，业务层校验）
     */
    private Integer followeeId;

    /**
     * 关注时间
     */
    private LocalDateTime followedAt;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        UserFollows other = (UserFollows) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getFollowerId() == null ? other.getFollowerId() == null : this.getFollowerId().equals(other.getFollowerId()))
            && (this.getFolloweeId() == null ? other.getFolloweeId() == null : this.getFolloweeId().equals(other.getFolloweeId()))
            && (this.getFollowedAt() == null ? other.getFollowedAt() == null : this.getFollowedAt().equals(other.getFollowedAt()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getFollowerId() == null) ? 0 : getFollowerId().hashCode());
        result = prime * result + ((getFolloweeId() == null) ? 0 : getFolloweeId().hashCode());
        result = prime * result + ((getFollowedAt() == null) ? 0 : getFollowedAt().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", followerId=").append(followerId);
        sb.append(", followeeId=").append(followeeId);
        sb.append(", followedAt=").append(followedAt);
        sb.append("]");
        return sb.toString();
    }
}